package net.oschina.victor.liu.lemon.repsotory;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import net.oschina.victor.liu.lemon.entity.Role;
import net.oschina.victor.liu.lemon.entity.User;

@Repository
public interface UserRepsotory extends PagingAndSortingRepository<User, Long>, JpaSpecificationExecutor<User> {

	@Query(value = "SELECT r FROM Role r WHERE r.id=(SELECT max(r1.id) FROM Role r1 )")
	public List<Role> findRolesByUser();

}
